<?php
declare (strict_types=1);

namespace app\listener;

use app\constant\CommonConstant;
use app\exception\PushShopifyOrderException;
use app\exception\QueueRuntimeException;
use app\model\LineItems;
use app\model\Notify;
use app\model\Orders;
use app\model\ShopsPayment;
use app\service\shopify\action\graph\OrderGraph;
use app\service\shopify\action\rest\DraftOrderRest;
use app\service\shopify\action\rest\OrderRest;
use app\trait\ShopifyTrait;
use think\helper\Arr;

class PushOrderListener
{
    use ShopifyTrait;

    /**
     * 事件监听处理
     *
     * @return mixed
     */
    public function handle($event)
    {
        $order = $event->getOrder();
        $debug = $event->getDebug();
        try {
            $this->completedDraftOrder($order, $debug);
        } catch (\Exception $e) {
            Orders::saveExceptionMessage($order, $e->getMessage());
        }
    }

}
